#include <vector>
#include <fstream>
#include <iostream>
#include <string>

#include <boost/serialization/vector.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>
#include <fstream>

void saveVectorToFile(const std::vector<std::vector<double>>& data, const std::string& filename) {
    std::ofstream outFile(filename);
    if (!outFile.is_open()) {
        std::cerr << "无法打开文件进行写入：" << filename << std::endl;
        return;
    }

    // 写入外层 vector 的大小
    outFile << data.size() << std::endl;

    // 遍历每个内层 vector
    for (const auto& innerVec : data) {
        // 写入内层 vector 的大小
        outFile << innerVec.size();

        // 写入内层 vector 的元素
        for (const auto& value : innerVec) {
            outFile << " " << value;
        }

        // 换行，准备写入下一个内层 vector
        outFile << std::endl;
    }

    outFile.close();
}


std::vector<std::vector<double>> loadVectorFromFile(const std::string& filename) {
    std::ifstream inFile(filename);
    std::vector<std::vector<double>> data;

    if (!inFile.is_open()) {
        std::cerr << "无法打开文件进行读取：" << filename << std::endl;
        return data;
    }

    // 读取外层 vector 的大小
    size_t outerSize;
    inFile >> outerSize;

    // 预先调整外层 vector 的大小
    data.resize(outerSize);

    // 逐一读取每个内层 vector
    for (size_t i = 0; i < outerSize; ++i) {
        size_t innerSize;
        inFile >> innerSize;

        data[i].resize(innerSize);

        // 读取内层 vector 的元素
        for (size_t j = 0; j < innerSize; ++j) {
            inFile >> data[i][j];
        }
    }

    inFile.close();
    return data;
}

void saveVectorToBinaryFile(const std::vector<std::vector<double>>& data, const std::string& filename) {
    std::ofstream outFile(filename, std::ios::binary);
    if (!outFile.is_open()) {
        std::cerr << "无法打开文件进行写入：" << filename << std::endl;
        return;
    }

    // 写入外层 vector 的大小
    size_t outerSize = data.size();
    outFile.write(reinterpret_cast<const char*>(&outerSize), sizeof(outerSize));

    // 遍历每个内层 vector
    for (const auto& innerVec : data) {
        // 写入内层 vector 的大小
        size_t innerSize = innerVec.size();
        outFile.write(reinterpret_cast<const char*>(&innerSize), sizeof(innerSize));

        // 写入内层 vector 的元素
        outFile.write(reinterpret_cast<const char*>(innerVec.data()), innerSize * sizeof(double));
    }

    outFile.close();
}

std::vector<std::vector<double>> loadVectorFromBinaryFile(const std::string& filename) {
    std::ifstream inFile(filename, std::ios::binary);
    std::vector<std::vector<double>> data;

    if (!inFile.is_open()) {
        std::cerr << "无法打开文件进行读取：" << filename << std::endl;
        return data;
    }

    // 读取外层 vector 的大小
    size_t outerSize;
    inFile.read(reinterpret_cast<char*>(&outerSize), sizeof(outerSize));

    data.resize(outerSize);

    // 逐一读取每个内层 vector
    for (size_t i = 0; i < outerSize; ++i) {
        size_t innerSize;
        inFile.read(reinterpret_cast<char*>(&innerSize), sizeof(innerSize));

        data[i].resize(innerSize);

        // 读取内层 vector 的元素
        inFile.read(reinterpret_cast<char*>(data[i].data()), innerSize * sizeof(double));
    }

    inFile.close();
    return data;
}

void saveVectorWithBoost(const std::vector<std::vector<double>>& data, const std::string& filename) {
    std::ofstream outFile(filename);
    boost::archive::text_oarchive oa(outFile);
    oa << data;
}

std::vector<std::vector<double>> loadVectorWithBoost(const std::string& filename) {
    std::ifstream inFile(filename);
    boost::archive::text_iarchive ia(inFile);
    std::vector<std::vector<double>> data;
    ia >> data;
    return data;
}

#include <numeric>
std::vector<double> createVector(int n) {
    std::vector<double> vec(n + 1); // 创建一个大小为 n+1 的 vector
    std::iota(vec.begin(), vec.end(), 0); // 从 0 开始填充
    return vec;
}

double action_1[][14] = 
{
    
//1站-仰卧
  //const int act_num=4;
  //double act[act_num][14]={
  {0,0,0,0,0,0,0,0,0,0,0,0,  0.4,400},
    {0.04,-0.94,-2.45,-0.08,-0.00,0.23,-0.02,0.96,2.45,0.00,-0.06,-0.18,  1.3,80},
    {0.06,-0.18,-1.90,-0.04,0.04,0.33,0.04,0.13,1.88,-0.04,0.03,-0.31,  2.3,60},
    //{0.09,-0.52,-1.78,-0.12,0.07,-1.60,0.07,0.29,1.62,0.00,-0.03,1.66,  0.3,500},
    //{0.03,-0.41,-0.70,-0.10,0.01,-0.40,0.02,0.37,0.60,0.05,0.00,0.35,  29.3,500},    
    {0,0.0,0,0,0,0,0,0,0,0,0,0,  0.8,300},
};

double action_2[][14] = 
{
    //2仰卧-站
  //const int act_num=5;    
  //double act[act_num][14]={//12motor pos, last two value: speed and wait time  
    {0,0,0,0,0,0,0,0,0,0,0,0,  0.4,400},
    {-0.029,0,-2.441, 0.06, -0.012,-0.944,  0.021,0,2.471,-0.06,-0.039,0.927,1.3,100},
    {-0.079, -0.951, -2.494, 0.058, 0.049, 0.243, 0.036, 0.981, 2.552, -0.058, -0.057, -0.204,1.9,50},
    {-0.079, -0.951, -2.494, 0.058, 0.049, -1.578, 0.036, 0.981, 2.552, -0.058, -0.057, 1.615,1.9,50},
    {0,0,0,0,0,0,0,0,0,0,0,0,0.8,300},
};

double action_3[][14] = 
{
//3站-俯卧
  //const int act_num=5;
  //double act[act_num][14]={
    {0,0,0,0,0,0,0,0,0,0,0,0,  0.4,400},
    {-0.02,-0.97,-2.53,0.01,0.01,-1.57,0.10,0.97,2.54,-0.09,-0.06,1.60,  1.4,60},    
    {0.26,-0.44,-0.71,1.06,1.19,-2.61,-0.14,0.09,0.19,-0.75,-1.32,2.34,  0.8,140},
    {0.25,-0.13,-0.72,-1.06,1.24,-0.58,-0.13,0.16,0.52,1.15,-1.21,0.51,  1.4,80},
    {-0.02,-0.43,-0.92,0.01,-0.01,-0.35,-0.01,0.48,0.95,0.00,-0.04,0.36,  1.4,280},

//4俯卧-站  
  //const int act_num=5;
  //double act[act_num][14]={
  {-0.00,-0.34,-0.91,-0.03,0.04,-0.39,0.04,0.27,0.93,0.04,-0.06,0.40,  1.6,300},
    {-0.03,-0.97,-2.19,0.10,0.12,-3.41,0.12,0.97,2.24,-0.13,-0.10,3.40,  1.0,100},
    {-0.01,-0.97,-2.50,0.07,0.04,-4.25,0.00,0.98,2.51,-0.09,-0.08,4.26,  1.3,110},
    {-0.01,-0.96,-1.57,0.01,0.13,-3.01,0.01,0.96,1.57,-0.01,-0.13,3.01,  0.8,110},
    {0,0,0,0,0,0,0,0,0,0,0,0,  0.8,300},
};

double action_4[][14] = 
{
//5倒立
  //const int act_num=13;    
  //double act[act_num][14]={//12motor pos, last two value: speed and wait time
    {0,0,0,0,0,0,0,0,0,0,0,0,0.6,500},//站直
    {-0.291,-0.910,-1.761,0.153,0.239,-3.497,0.173,0.959,1.889,-0.102,-0.181,3.586,  0.4,260},//蹲
    {0.111,-0.962,-2.507,0.252,0.129,-4.611,0.145,0.965,2.459,-0.342,-0.232,4.516,   0.6,160},//低头
    {-0.025,-0.975,-2.492,0.105,0.223,-3.472,-0.025,0.974,2.492,-0.105,-0.223,3.5,   0.7,140},//脚缩起往后    
    {-0.236,-0.305,-0.710,0.045,0.116,-0.440,0.033,0.97,2.49,-0.104,-0.223,3.5,   0.6,160},//左脚起
    {-0.160,-0.102,-0.589,-0.121,0.216,0.062,-0.050,0.291,1.017,-0.036,-0.080,0.713,   0.6,130},//右脚起    
    {-0.031,-0.117,-0.173,-0.003,0.088,-0.337,0.251,-0.018,0.085,0.093,-0.269,-0.185,   0.6,160},
    {-0.050,0.048,-0.050,0.109,1.183,-0.008,0.172,0.030,0.051,0.041,-1.148,0.106,   0.6,200},//脚两边打开    
    {0,0,0,0,0,0,0,0,0,0,0,0,0.7,160},//并脚
    {0.058,-0.970,-2.515,0.021,-0.052,-0.831,0.063,0.978,2.555,-0.040,-0.031,0.806,   0.7,140},//缩腿      
    {-0.029,-0.974,-2.414,0.324,0.239,1.604,0.035,0.981,2.529,-0.160,-0.119,-1.534,   0.4,240},//缩腿转下    
    {-0.168,-0.723,-1.223,0.109,0.143,2.562,0.182,0.685,1.287,-0.064,-0.106,-2.456,   0.6,160},//半蹲
    {0,0,0,0,0,0,0,0,0,0,0,0,0.3,550},//站直      
};

double action_5[][14] = 
{
//6扭腰
  //int act_num=15;
  //double act[act_num][14]={
    {0,0,0,0,0,0,0,0,0,0,0,0,  0.4,300},
    {-0.28,-0.5,-0.66,0.06,-0.0,-0.06,-0.15,0.89,1.07,0.17,-0.05,0.09,  0.7,200},//右侧
    {0.15,-0.89,-1.07,-0.17,0.05,-0.09,0.28,0.50,0.66,-0.06,0.00,0.06,  0.9,120},//左侧
    {-0.28,-0.5,-0.66,0.06,-0.0,-0.06,-0.15,0.89,1.07,0.17,-0.05,0.09,  0.9,120},//右侧
    {0.15,-0.89,-1.07,-0.17,0.05,-0.09,0.28,0.50,0.66,-0.06,0.00,0.06,  0.9,120},//左侧
    {-0.28,-0.5,-0.66,0.06,-0.0,-0.06,-0.15,0.89,1.07,0.17,-0.05,0.09,  0.9,120},//右侧
    {0.15,-0.89,-1.07,-0.17,0.05,-0.09,0.28,0.50,0.66,-0.06,0.00,0.06,  0.9,120},//左侧
    {0,0,0,0,0,0,0,0,0,0,0,0,  0.4,200},
    {-0.07,-0.37,-1.05,0.48,-0.33,-0.61,0.28,0.81,1.00,0.62,-0.25,0.06,  1.4,60},//左转
    {-0.28,-0.81,-1.00,-0.62,0.25,-0.06,0.07,0.37,1.05,-0.48,0.33,0.61,  1.4,60},//右转
    {-0.07,-0.37,-1.05,0.48,-0.33,-0.61,0.28,0.81,1.00,0.62,-0.25,0.06,  1.4,60},//左转
    {-0.28,-0.81,-1.00,-0.62,0.25,-0.06,0.07,0.37,1.05,-0.48,0.33,0.61,  1.4,60},//右转
    {-0.07,-0.37,-1.05,0.48,-0.33,-0.61,0.28,0.81,1.00,0.62,-0.25,0.06,  1.4,60},//左转
    {-0.28,-0.81,-1.00,-0.62,0.25,-0.06,0.07,0.37,1.05,-0.48,0.33,0.61,  1.4,60},//右转
    {0,0,0,0,0,0,0,0,0,0,0,0,  0.4,300},
};

double action_6[][14] = 
{
//7前滚
  //const int act_num=10;
  //double act[act_num][14]={
    {-0.02,-0.97,-1.77,0.05,0.06,-0.91,0.02,0.97,1.77,-0.05,-0.06,0.91,  0.3,300},
    {-0.02,-0.97,-1.51,-0.01,0.12,-2.49,0.15,0.96,1.54,-0.07,-0.12,2.57,  0.3,340},
    {0.00,-0.97,-0.18,-0.06,0.10,-1.80,0.15,0.96,0.33,0.00,-0.10,1.97,  0.4,200},
    {-0.04,-0.79,-1.23,0.00,0.10,-2.52,0.15,0.30,1.31,-0.07,-0.05,2.57,  0.5,180},
    {-0.02,-0.97,-1.87,0.10,0.07,-1.18,0.15,0.18,1.42,-0.24,-0.17,2.73,  0.5,280},
    {0.00,-0.29,-1.76,-0.01,-0.11,0.02,0.15,0.02,1.89,-0.04,-0.19,2.12,  0.5,200},
    {0.00,-0.56,-1.95,0.08,0.06,1.61,0.15,0.70,1.65,-0.03,-0.04,0.87,  0.5,200},
    {-0.19,-0.63,-2.02,0.21,0.01,1.74,0.26,0.73,2.05,-0.21,-0.04,-1.81,  0.5,200},
    {0.04,-0.97,-1.97,0.03,0.08,1.49,-0.00,0.98,1.93,-0.03,-0.08,-1.56,  0.5,200},
    {-0.02,-0.97,-1.77,0.05,0.06,-0.91,0.02,0.97,1.77,-0.05,-0.06,0.91,  0.5,200},
};

double action_7[][14] = 
{
 
//8劈腿
  //const int act_num=16;
  //double act[act_num][14]={
  {0,0,0,0,0,0,0,0,0,0,0,0,  0.2,800},
  {0.27,0.01,0.00,0.00,-0.24,-0.01,0.17,0.00,0.00,0.00,-0.14,-0.01,  0.3,400},
    {0.33,-0.01,-0.04,0.01,-0.03,-0.03,0.06,0.54,0.40,-0.00,0.11,0.19,  0.3,400},
    //{0.30,-0.02,0.00,0.00,-0.04,-0.03,-0.06,0.22,0.55,0.09,0.17,0.28,  0.3,400},
    {0.27,-0.05,-0.01,-0.01,0.12,0.02,-0.01,0.56,1.10,0.15,0.33,0.64,  0.3,400},
    {0.36,-0.06,-0.01,0.02,-0.04,-0.03,-0.01,0.72,1.35,0.14,0.23,0.75,  0.3,420},
    {0.28,-0.05,0.00,0.03,0.19,0.08,0.00,0.78,2.16,0.43,0.06,1.30,  0.3,400},
    {0.26,-0.13,-0.03,-0.07,0.23,0.29,0.00,0.65,2.14,0.28,-0.18,2.11,  0.3,400},
    {0.26,-0.18,-0.07,-0.09,0.26,0.59,0.00,0.53,1.80,0.19,-0.43,3.13,  0.3,360},
    
    {0.16,-0.11,-0.03,-0.13,0.82,0.34,0.00,0.11,0.13,0.00,-1.02,2.99,  0.3,1500},
    
    {0.26,-0.18,-0.07,-0.09,0.26,0.59,0.00,0.53,1.80,0.19,-0.43,3.13,  0.3,360},
    {0.26,-0.05,-0.03,-0.07,0.23,0.29,0.00,0.65,2.14,0.28,-0.18,2.11,  0.3,400},
    {0.28,-0.05,0.00,0.03,0.19,0.08,0.00,0.78,2.16,0.43,0.06,1.30,  0.3,400},    
    {0.36,-0.06,-0.01,0.02,-0.04,-0.03,-0.01,0.72,1.35,0.14,0.18,0.75,  0.3,380},    
    {0.27,-0.05,-0.01,-0.01,0.12,0.02,-0.01,0.56,1.10,0.15,0.23,0.64,  0.3,400},
    {0.33,-0.01,-0.04,0.01,-0.03,-0.03,0.06,0.54,0.40,-0.00,0.11,0.19,  0.3,400},
    {0,0,0,0,0,0,0,0,0,0,0,0,  0.4,400},
};

double action_8[][14] = 
{
     
//9压腿  
  //const int act_num=13;
  //double act[act_num][14]={
  {0,0,0,0,0,0,0,0,0,0,0,0,  0.3,500},
  {0.00,-0.81,-2.51,-0.09,-0.01,-1.74,0.08,0.79,2.55,-0.08,0.00,1.81,  0.5,220},
  {0.86,-0.89,-2.41,-0.89,0.01,-1.49,1.02,0.91,2.28,-0.97,-0.13,1.41,  0.5,200},
  //{-0.61,-0.02,-0.06,0.09,0.57,-0.14,0.59,0.08,0.09,-0.01,-0.56,0.08,  0.3,500},//2开脚
    {-0.17,-0.96,-2.55,-0.02,0.03,-1.64,1.42,-0.01,-0.03,-0.00,-1.59,0.03,  0.5,220}, //3压腿
    {-0.37,-0.93,-1.97,0.18,0.05,-1.07,1.11,-0.00,-0.01,0.08,-1.24,-0.07,  0.8,160},//4抬起
    {-0.17,-0.96,-2.55,-0.02,0.03,-1.64,1.42,-0.01,-0.03,-0.00,-1.59,0.03,  0.8,140}, //5    
    {-0.61,-0.02,-0.06,0.09,0.57,-0.14,0.59,0.08,0.09,-0.01,-0.56,0.08,  0.5,200},//6开脚        
    {-1.42,0.01,0.03,0.00,1.59,-0.03,0.17,0.96,2.55,0.02,-0.03,1.64,  0.5,220},//7压腿
    {-1.11,0.00,0.01,-0.08,1.24,0.07,0.37,0.93,1.97,-0.18,-0.05,1.07,  0.8,120},//8抬起
    {-1.42,0.01,0.03,0.00,1.59,-0.03,0.17,0.96,2.55,0.02,-0.03,1.64,  0.8,140},//9
    //{-0.61,-0.02,-0.06,0.09,0.57,-0.14,0.59,0.08,0.09,-0.01,-0.56,0.08,  0.3,300}//开脚 
  {-1.02,-0.91,-2.28,0.97,0.13,-1.41,-0.86,0.89,2.41,0.89,-0.01,1.49,  0.5,200},
  {0.00,-0.81,-2.51,-0.09,-0.01,-1.74,0.08,0.79,2.55,-0.08,0.00,1.81,  0.7,200},
  {0,0,0,0,0,0,0,0,0,0,0,0,  0.6,300},
};


double action_9[][14] = 
{
//10侧滚
  //const int act_num=12;
  //double act[act_num][14]={
  //{0,0,0,0,0,0,0,0,0,0,0,0,  0.3,500},
    //{0.03,0.11,0.01,-1.64,0.09,-0.03,-0.04,-0.00,0.12,1.55,-0.12,0.05,  0.1,1000},//ping foot
    
    
    {0,0.99,0.48,-1.57,0.50,0,  0,0.98,0.53,1.57,0.46,0,  0.3,500},
    {0,0.99,1.24,-1.57,0.35,0,  0,0.98,0.68,1.57,0.46,0,  0.3,500},
    {0,0.51,0.99,-1.57,2.54,0,  0,0.93,0.45,1.57,0.46,0,  0.1,1000},//
    {0,0.33,0.92,-1.57,2.71,0,  0,0.11,0.90,1.57,-2.34,0,  0.05,2000},
    {0,0.40,0.53,-1.57,2.83,0,  0,-0.99,-0.93,1.57,-2.34,0,  0.1,1000},
    {0,-0.03,0.58,-1.57,2.76,0,  0,-0.99,-1.70,1.57,-1.99,0,  0.1,1000},//touch groud
    
    
    {  0,0.99,1.70,-1.57,1.99,0,  0,0.03,-0.58,1.57,-2.76,0,    0.1,1000},//touch groud
    {  0,0.99,0.93,-1.57,2.34,0,    0,-0.40,-0.53,1.57,-2.83,0,  0.3,500},
    {  0,-0.11,-0.90,-1.57,2.34,0,  0,-0.33,-0.92,1.57,-2.71,0,  0.05,2000},
    {  0,-0.93,-0.45,-1.57,-0.46,0,  0,-0.51,-0.99,1.57,-2.54,0,  0.1,1000},//
    {  0,-0.98,-0.68,-1.57,-0.46,0,  0,-0.99,-1.24,1.57,-0.35,0,  0.3,500},
    {  0,-0.98,-0.53,-1.57,-0.46,0,  0,-0.99,-0.48,1.57,-0.50,0,  0.3,500},
};

int main() {
    std::vector<std::vector<double>> data = {
        {1.2322340f, 2.123123123f, 3.12321f},
        {4.444f, 5.219383f, 6.2929f},
        {7.0f, 8.0f, 9.0f}
    };

    // saveVectorToFile(data, "data.txt");
    // std::vector<std::vector<double>> loadedData = loadVectorFromFile("data.txt");    

    // saveVectorToBinaryFile(data, "data.bin");
    // std::vector<std::vector<double>> loadedData = loadVectorFromBinaryFile("data.bin");

    saveVectorWithBoost(data, "data.boost");
    std::vector<std::vector<double>> loadedData = loadVectorWithBoost("way_point.boost");
    std::cout << loadedData.size() << std::endl;

    for (const auto& innerVec : loadedData) {
        for (const auto& value : innerVec) {
            std::cout << value << " ";
        }
        std::cout << std::endl;
    }
    
    int n = 5; // 示例值
    std::vector<double> vec = createVector(n);

    std::cout << "Vector: ";
    for (int value : vec) {
        std::cout << value << " ";
    }
    std::cout << std::endl;

    std::cout << "action:" << sizeof(action_9)/(sizeof(double)*14) << std::endl;

    std::vector<std::vector<double>> action_boost;
    int joint_num = 12;

    int act_num = sizeof(action_1)/(sizeof(double)*14);
    for (int i = 0; i < act_num; i++) 
    {
        std::vector<double> joint_pos;
        for (int j = 0; j < joint_num; j++) 
        {
            joint_pos.push_back(action_1[i][j]);
        }
        action_boost.push_back(joint_pos);
    }
    saveVectorWithBoost(action_boost, "action_1.boost");
    action_boost.clear();

    act_num = sizeof(action_2)/(sizeof(double)*14);
    for (int i = 0; i < act_num; i++) 
    {
        std::vector<double> joint_pos;
        for (int j = 0; j < joint_num; j++) 
        {
            joint_pos.push_back(action_2[i][j]);
        }
        action_boost.push_back(joint_pos);
    }
    saveVectorWithBoost(action_boost, "action_2.boost");
    action_boost.clear();

    act_num = sizeof(action_3)/(sizeof(double)*14);
    for (int i = 0; i < act_num; i++) 
    {
        std::vector<double> joint_pos;
        for (int j = 0; j < joint_num; j++) 
        {
            joint_pos.push_back(action_3[i][j]);
        }
        action_boost.push_back(joint_pos);
    }
    saveVectorWithBoost(action_boost, "action_3.boost");
    action_boost.clear();

    act_num = sizeof(action_4)/(sizeof(double)*14);
    for (int i = 0; i < act_num; i++) 
    {
        std::vector<double> joint_pos;
        for (int j = 0; j < joint_num; j++) 
        {
            joint_pos.push_back(action_4[i][j]);
        }
        action_boost.push_back(joint_pos);
    }
    saveVectorWithBoost(action_boost, "action_4.boost");
    action_boost.clear();

    act_num = sizeof(action_5)/(sizeof(double)*14);
    for (int i = 0; i < act_num; i++) 
    {
        std::vector<double> joint_pos;
        for (int j = 0; j < joint_num; j++) 
        {
            joint_pos.push_back(action_5[i][j]);
        }
        action_boost.push_back(joint_pos);
    }
    saveVectorWithBoost(action_boost, "action_5.boost");
    action_boost.clear();

    act_num = sizeof(action_6)/(sizeof(double)*14);
    for (int i = 0; i < act_num; i++) 
    {
        std::vector<double> joint_pos;
        for (int j = 0; j < joint_num; j++) 
        {
            joint_pos.push_back(action_6[i][j]);
        }
        action_boost.push_back(joint_pos);
    }
    saveVectorWithBoost(action_boost, "action_6.boost");
    action_boost.clear();

    act_num = sizeof(action_7)/(sizeof(double)*14);
    for (int i = 0; i < act_num; i++) 
    {
        std::vector<double> joint_pos;
        for (int j = 0; j < joint_num; j++) 
        {
            joint_pos.push_back(action_7[i][j]);
        }
        action_boost.push_back(joint_pos);
    }
    saveVectorWithBoost(action_boost, "action_7.boost");
    action_boost.clear();

    act_num = sizeof(action_8)/(sizeof(double)*14);
    for (int i = 0; i < act_num; i++) 
    {
        std::vector<double> joint_pos;
        for (int j = 0; j < joint_num; j++) 
        {
            joint_pos.push_back(action_8[i][j]);
        }
        action_boost.push_back(joint_pos);
    }
    saveVectorWithBoost(action_boost, "action_8.boost");
    action_boost.clear();

    act_num = sizeof(action_9)/(sizeof(double)*14);
    for (int i = 0; i < act_num; i++) 
    {
        std::vector<double> joint_pos;
        for (int j = 0; j < joint_num; j++) 
        {
            joint_pos.push_back(action_9[i][j]);
        }
        action_boost.push_back(joint_pos);
    }
    saveVectorWithBoost(action_boost, "action_9.boost");
    action_boost.clear();

    return 0;
}